package com.ruoyi.mapper;

import com.ruoyi.domain.AdvInoutstock;
import com.ruoyi.domain.AdvProducts;
import com.ruoyi.domain.AdvUpgrade;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * Mapper接口
 *
 * @author ruoyi
 * @date 2024-05-13
 */
public interface AdvProductsMapper
{
    /**
     * 查询
     *
     * @param advProductsId 主键
     * @return
     */
    public AdvProducts selectAdvProductsByAdvProductsId(Long advProductsId);

    /**
     * 查询列表
     *
     * @param advProducts
     * @return 集合
     */
    public List<AdvProducts> selectAdvProductsList(AdvProducts advProducts);

    public List<AdvProducts> selectAdvProductsListApp(AdvProducts advProducts);

    /**
     * 新增
     *
     * @param advProducts
     * @return 结果
     */
    public int insertAdvProducts(AdvProducts advProducts);

    /**
     * 修改
     *
     * @param advProducts
     * @return 结果
     */
    public int updateAdvProducts(AdvProducts advProducts);

    /**
     * 删除
     *
     * @param advProductsId 主键
     * @return 结果
     */
    public int deleteAdvProductsByAdvProductsId(Long advProductsId);

    /**
     * 批量删除
     *
     * @param advProductsIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteAdvProductsByAdvProductsIds(Long[] advProductsIds);

    int deleteByTag(Long[] advProductsIds);

    List<AdvProducts> findcollect(@Param("advMembersId") Long advMembersId,@Param("productType")  Long productType);

    List<AdvProducts> findBuyWithDevicesno(@Param("devicesno") String devicesno, @Param("advMembersId") String advMembersId);

    AdvProducts isBuy(@Param("advMembersId") Long advMembersId, @Param("advProductsId") Long advProductsId);


    //获取当前设备已经同步的内容产品ID列表
    List<Integer> querySyncedProductsIds(@Param("devicesno") String devicesno);

    String queryVideoSizeById(@Param("advProductsId") int advProductsId);

    //根据产品ID获取产品信息
    Map<String, Object> queryProductById(@Param("productsId")Integer productsId);

    //查询默认视频id
    Integer queryDefaultVideo(@Param("devicesno") String id);

    //根据设备编号查询重启时间
    String queryRestartTime(@Param("devicesno") String id);

    //出库库存-1
    void subStock(@Param("advProductsId") Long advProductsId , @Param("stocknum") int stocknum,@Param("num") int num,@Param("myNum") int myNum);
    //入库库存+1
    void addStock(@Param("stocknum") int stocknum,@Param("advProductsId") Long advProductsId);

    //使用库存数据
    int queryProductBefore(@Param("advProductsId") Long advProductsId);

    String queryUpdatetime(@Param("id") String id);

    AdvInoutstock queryByInoutStock(@Param("devicesno") String devicesno);

    void deleteByDevicerelation(@Param("advProductsId") Long advProductsId);

    @Delete("delete from adv_products")
    void clear();

    List<AdvProducts> getOrderProduct();
}
